package org.thunms.schedule.quartz.service;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.thunms.framework.quartz.QuartzJobSupport;
import org.thunms.framework.utils.UtilDateTime;
@Service
public class MyQuartzJobBean extends QuartzJobSupport  {
	private static final long serialVersionUID = -3353386412322434559L;
	private static final Logger logger = LoggerFactory.getLogger(MyQuartzJobBean.class);
	
	

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		try {
			System.out.println("qrtzJobKey:"+context.getJobDetail().getJobDataMap().getString("qrtzJobKey"));
			System.out.println("任务分组:"+context.getJobDetail().getKey().getGroup()+"."+context.getJobDetail().getKey().getName());
			System.out.println("执行时间:"+UtilDateTime.toDateTimeString(UtilDateTime.nowDate()));
		} catch (Exception e) {
			logger.error("任务执行过程出现异常",e);
		}
		
	}



	@Override
	public String getJobName() {
		return "测试任务";
	}



	@Override
	public String getJobGroup() {
		return "测试组";
	}



	@Override
	public String getDescription() {
		return "一个入门级的测试任务";
	}



	@Override
	public Class<?> getJobClass() {
		return this.getClass();
	}



	



	
	
}
